public class Solution984 {
    public String strWithout3a3b(int a, int b) {
        StringBuilder stringBuilder=new StringBuilder();
        int last1=-1,last2=-1;
        while (a!=0 || b!=0){
            if (a!=0 && ((a>=b && !(last1==1 && last2==1))||(last1==2 && last2==2))){
                stringBuilder.append('a');
                last2=last1;
                last1=1;
                a--;
            }else {
                stringBuilder.append('b');
                last2=last1;
                last1=2;
                b--;
            }
        }
        return stringBuilder.toString();
    }

    public static void main(String[] args) {
        System.out.println(new Solution984().strWithout3a3b(1,4));
    }
}
